package uk.ac.manchester.cs.haphan.modbench;

import java.io.File;
import java.io.FilenameFilter;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;

/**
 *
 * @author phanh
 */
public class Helper {

    // reasoner timeout 15 minutes
    // explanation finding maximal 100 explanations
    // total 25 hours maximum per ontology
    public static long REASONERTIMEOUT = 900000;
    public static int MAXEXPLANATIONS = 5;


    public static double round(double d, int decimalPlace) {
        BigDecimal bd = new BigDecimal(Double.toString(d));
        bd = bd.setScale(decimalPlace, BigDecimal.ROUND_HALF_UP);
        return bd.doubleValue();
    }

    public static String CurrentDate() {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HHmm");
        return sdf.format(cal.getTime());
    }

    public static String NF(int number) {
        String formatted = String.format("%03d", number);
        return formatted;
    }

    public static FilenameFilter ff(final String str) {
        FilenameFilter filter = new FilenameFilter()
            { public boolean accept(File dir, String name){ return !name.contains(str);}};
        return filter;
    }


}